package org.example.common.powerjob;


import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tech.powerjob.client.PowerJobClient;

/**
 * PowerJob 配置类（5.1.2 版本）
 */
@Configuration
@Data
public class PowerJobConfig {

    @Value("${powerjob.worker.server-address}")
    private String serverAddress;

    @Value("${powerjob.worker.app-name}")
    private String appName;

    @Value("${powerjob.worker.password}")
    private String password;

    /**
     * 创建 PowerJob 客户端
     * PowerJob 5.x 版本的构造函数签名：
     * PowerJobClient(String serverAddress, String appName, String password, long timeout)
     */
    @Bean
    public PowerJobClient initPowerJobClient() {
        return new PowerJobClient(serverAddress, appName, password);
    }
}